from pythonds.basic import Deque
from collections import deque


def huiwen_check(s: str) -> bool:
    str_dq = Deque()
    for v in s:
        str_dq.add_front(v)

    while len(str_dq) > 1:
        lc = str_dq.remove_front()
        rc = str_dq.remove_rear()
        if lc != rc:
            return False

    return True


def test():
    d = deque()
    d.append(12)
    print(len(d))
    x = d.pop()
    print(x)
    print(len(d))
    print("-" * 15)
    dq = Deque()
    dq.add_front(12)
    x = dq.remove_front()
    print(x)
    x = dq.remove_front()
    print(x)
    print(dq.size())
    # 回文检测 -------------------------------------------
    print(huiwen_check("上海自来水来自海上1"))
    print(huiwen_check("121"))
    print(huiwen_check("1221"))
